package com.carful.xigua.modules.common.advice;


import com.carful.xigua.modules.common.entity.Rest;
import com.carful.xigua.modules.common.entity.RestBody;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author Administrator
 * Date 2024/2/23 14:34
 * Description
 */

@RestControllerAdvice
@Order(3)
@Slf4j
public class RuntimeExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    public Rest<RuntimeException> handler(RuntimeException e) {
        log.error("RuntimeException : ", e);
        return RestBody.build(500, null, e.getMessage(), null);
    }
}
